<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>康纳天花系统后台</title>
<link href="/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="/css/admins/base.css" rel="stylesheet" type="text/css">
<link href="/css/plugs/jDatepicker/jDatepicker-min.css"  rel="stylesheet"  />
    <link href="/css/validate.css" rel="stylesheet" type="text/css" />
<script src="/js/plugs/jquery.js"></script>
<script src="/js/admins/base.js"></script>
<script src="/js/plugs/jDatepicker/jDatepicker-min.js"></script>
    <script type="text/javascript" src="/js/plugs/jquery.imgupload.js"></script>
<script src="/js/plugs/validate.js"></script>
<script src="/js/admins/salesman_manage.js"></script>
<style type="text/css" >
.add-form {
	width:100%;
}
.add-form input{
	width:30em;
}

.uploader_item_box  {
   width: 115px;
    height:110px;
}



</style>
</head>

<body>

<!-- nav start-->
{# include file="$tpl_root_path/admins/base/navbar.html" #}
<!-- nav end -->    
    
    
    
    
<div class="container-fluid">
    
      <div class="row">
      
    <!-- left  box start-->     
       {# include file="$tpl_root_path/admins/base/left_menu.html" #}
    <!-- left  box end-->        
 
  <!-- right  box start-->  
         
     <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main right-box">
          
          <div class="menu-navbar">{#$menu_navbar#}</div>
          <h3 class="page-header">新增Banner图</h3>

       
          
          <div class="info-list-box">
          
          <div class="add-form">
                <form class="form-horizontal" method="post"   >

                    <div class="form-group">
                      <label for="inputEmail3" class="col-sm-2 control-label" >位置<span class="must-fill">*</span></label>
                      <div class="col-sm-10">
                          <select class="form-control" style="width: 100px;" name="position">
                           {#foreach from=$arrBannerPos item=i#}
                              <option value ="{#$i.ID#}" {#if $data.POSITION==$i.ID #}selected = "selected"{#/if#}>{#$i.NAME#}</option>
                           {#/foreach#}
                          </select>
                      </div>
                    </div>

                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label" >标题<span class="must-fill">*</span></label>
                        <div class="col-sm-10">
                            <input class="form-control"   type="text" size="30" name="title"  value="{#$data.TITLE#}" defaultshow="2-30个字"  checkItem="isBlank:'T|请填写标题',computeChar:'>2<30|标题不足2个字,标题不能超过30个字',isSimple:'T|标题太过简单'" >
                        </div>
                    </div>
                    
                    
                  <div class="form-group">
                      <label for="inputPassword3" class="col-sm-2 control-label" >链接地址</label>
                      <div class="col-sm-10">
                        <input class="form-control"    type="text" name="url"  value="{#$data.URL#}"  >
                      </div>
                    </div>
                    
                    
                  <div class="form-group">
                      <label for="inputPassword3" class="col-sm-2 control-label" >封面图<span class="must-fill">*</span></label>
                      <div class="col-sm-10">
                          <div class="clearfix">
                              <div  id="imgup"></div>
                              <span class="form_tips form_error_tips" style="display:none;"></span><a>&nbsp;</a>
                          </div>
                      </div>
                    </div>



                    
                    

                     
                    <div class="form-group">
                      <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" name="sub" value="1" class="btn btn-success" onclick="return checkPublish()">保&nbsp;&nbsp;存</button>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <a   href="/admins/banner_manage.html"  class="btn btn-default"  >返&nbsp;&nbsp;回</a>
                      </div>
                    </div>
               </form>
          </div>
    
          </div>
          
 

          
     </div>
 
  <!-- right  box end-->         
        
      </div>
</div>



</body>
</html>

<script type="text/javascript">

    //    //图片上传

    {# if  $data.ID eq '' #}
    $.imgUploader({
        containerid:'imgup',
        dir:'news',
        img_cnt_limit:1,
        max_file_size:1024*2,
        prevent_duplicates:1,
        extensions:'jpg,jpeg,gif,png',
        multi_selection:true,
        min_img_width:0,
        min_img_height:0,
        single_file:true
    });
    {#else#}
    {#$imgjs#}
    {#/if#}

    $("#imgup").bind("UploadComplete",function() {
        $('.form_tips').addClass(" form-ok").css("display","inline-block");
    });






    function back() {
		document.location.href = '/admins/banner_manage.html';
    }


    function checkPublish() {
        if (!validate())
            return false;


        //验证图片
        var pic = $("#imgup_filelist").html();
        if(pic == ''){
            $('.form_tips').removeClass('Validform_right').addClass("form-no").css("display","inline-block").text('请上传图片');
            return false;
        }else {
            $('.form_tips').removeClass('form-no').addClass("form-ok").css("display","inline-block").text(' ');
        }




    }



</script>